<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>

<s:include value="../header.jsp"></s:include>
<s:include value="../leftNav.jsp"></s:include>

<script type="text/javascript">
	$(function() {
		$("#progressbar").progressbar({
			value : ${hoursEffortPercentage}
		});
	});
</script>
		
<div id="content">

<div id="tabs">
	<ul>
		<li><s:a href="#tabs-1" action="testActionJsp.action">Display issue</s:a></li>
		<li><s:a href="#tabs-2" action="testActionJsp.action">History</s:a></li>
		<li><s:a href="#tabs-3" action="testActionJsp.action">Estimate</s:a></li>
		<li><s:a href="#tabs-4" action="testActionJsp.action">Assign</s:a></li>
		<li><s:a href="#tabs-5" action="testActionJsp.action">Comment</s:a></li>
		<li><s:a href="#tabs-6" action="testActionJsp.action">Enter Work</s:a></li>
		<li><s:a href="#tabs-7" action="testActionJsp.action">Info-Needed</s:a></li>
		<li><s:a href="#tabs-8" action="testActionJsp.action">Resolve</s:a></li>
		<li><s:a href="#tabs-9" action="testActionJsp.action">Verify</s:a></li>
		<li><s:a href="#tabs-10" action="testActionJsp.action">Close</s:a></li>
	</ul>
	<div id="tabs-1">
 		<fieldset><legend>General Information</legend>
 		<table>
 			<tr> 
 				<td style="width:50%;">Issue id: <s:property value="issueId"/></td>
 				<td>Confirmed: <s:property value="confirmed"/></td>
 			</tr>
 			<tr>
 				<td>Title: <s:property  value="title"/></td>
 			</tr>
 			<tr>
 				<td>Author: <s:property value="author"/></td>
 				<td>Creation date: <s:property value="creationDate"/></td>
 			</tr>
 			<tr>
 				<td>Priority: <s:property value="priority"/></td>
 				<td>Status: <s:property value="status"/></td>
 			</tr>
 			<tr>
 				<td>Type: <s:property value="type"/></td>
 				<td>Team: <s:property value="team"/></td>
 			</tr>
 		</table>
 		<center>
 			<s:url id="editIssue" value="editIssueForm.action">
				<s:param name="issueId" value="issueId" />
				<s:param name="editIssueForm" value="true"/>
			</s:url> 
			<s:a href="%{editIssue}">Edit Issue</s:a>
 		</center>
 		
 		</fieldset>
 		<br />
 		<fieldset><legend>Estimation (hours)</legend>
 			<table>
 				<tr>
 					<td style="width:50%;">Estimation (hours): <s:property value="estimationHours"/></td>
 					<td>Current effort (hours): <s:property value="currentEffort"/></td>
 			</table>
 			<div id="progressbar"></div>
 		</fieldset>
 		<br />
 		<fieldset><legend>Description</legend>
 			<s:property value="description"/>
 		</fieldset>
 		<br />
 		<fieldset><legend> Assigments </legend>
 			<s:if test="users.size > 0">
 				<table id="users">
 					<s:iterator value="users">
 						<tr>
 							<td>User: <s:property value="username"/></td>
 						</tr>
 					</s:iterator>
 				</table>
 			</s:if>
 		</fieldset>
 		<fieldset><legend> Ties with other issues </legend>
 			<s:if test="issueLinks.size > 0">
 				<table id="issueLinks">
 					<s:iterator value="issueLinks">
 						<tr>
 							<td>Issue number: <s:property value="link"/></td>
 						</tr>
 					</s:iterator>
 				</table>
 			</s:if>
 		</fieldset>
 		<fieldset><legend> Attachments </legend>
 			<s:if test="attachments.size > 0">
 				<table id="attachments">
 					<s:iterator value="attachments">
 						<tr>
 							<td style="width: 50%;">Filename: <s:property value="fileName"/></td>
 							<td>Content type: <s:property value="contentType"/></td>
 						</tr>
 					</s:iterator>
 				</table>
 			</s:if>
 		</fieldset>
 		<fieldset><legend> Notifications area </legend>
 			<s:if test="notifications.size > 0">
 				<table id="notifications">
 					<s:iterator value="notifications">
 						<tr>
 							<td>User id: <s:property value="userId"/></td>
 						</tr>
 					</s:iterator>
 				</table>
 			</s:if>
 		</fieldset>
 		
		<br />
		<div id="accordion">
			<div>
				<h3><a href="#">Step By Step</a></h3>
					<s:property value="stepByStep"/>
			</div>
			<div>
				<h3><a href="#">Source code</a></h3>
					<s:property value="sourceCode"/>
			</div>
			<div>
				<h3><a href="#">System Configuration</a></h3>
					<s:property value="systemConfiguration"/>
			</div>
			<div>
				<h3><a href="#">Workaround</a></h3>
					<s:property value="workaround"/>
			</div>
		</div>
		
	</div>
	<div id="tabs-2">
 		<p>Issue history</p>
		<s:if test="history.size > 0">
			<table id="history">
				<s:iterator value="history" status="historyStatus">
					<tr>
						<s:if test="#historyStatus.even == true">
							<td style="background-color: gray;">Summary: <s:property value="summary" /></td>
							<td style="background-color: gray;">Type: <s:property value="description" /></td>
							<td style="background-color: gray;">User: <s:property value="type" /></td>
							<td style="background-color: gray;">Comment:<s:property value="executor" /></td>
						</s:if>
						<s:else>
							<td>Summary: <s:property value="summary" /></td>
							<td>Type: <s:property value="type" /></td>
							<td>User: <s:property value="executor" /></td>
							<td>Comment:<s:property value="description" /></td>
						</s:else>
					</tr>
					<s:if test="historyAttributes.size > 0">
					<s:iterator value="historyAttributes">
						<table id="historyAttributes">
							<tr>
								<td><s:property value="name" /></td>
								<td><s:property value="value" /></td>
							</tr>
						</table>
					</s:iterator>
					</s:if>
					<br />
				</s:iterator>
			</table>
		</s:if>
	</div>
	<div id="tabs-3">
 		<p>Estimate</p>
		<s:form name="addForm"  method="post" action="estimate.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:textfield name="estimationHours" label="Estimation (hours)" size="10"/>
			<sx:datetimepicker name="estimationTime" label="Estimation (date)" 
				displayFormat="dd-MMM-yyyy" value="todayDate" />
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-4">
 		<p> Assigments</p>
		<s:form name="addForm" method="post" action="editAssigment.action" theme="xhtml">
			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<sx:autocompleter label="Add user" list="usersSystem" name="addedUser" size="30"/>
			<s:submit type="button" name="Add" label="Add user"/>
		</s:form>
		
		<s:if test="users.size > 0">
			<h3>Users already added to project:</h3>
			<table id="users">
				<tr>
						<td>Username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td>User email:</td>
				</tr>
				<s:iterator value="users">
					<tr>
						<td><s:property value="username" /></td>
						<td><s:property value="email" /></td>
						<td><s:url id="deleteUser" value="removeUsers.action">
								<s:param name="userId" value="userId" />
							</s:url> <s:a href="%{deleteUser}">Remove</s:a>
						</td>
					</tr>
				</s:iterator>
			</table>
		</s:if>
	</div>
	<div id="tabs-5">
 		<p>Add comment</p>
		<s:form name="addForm"  method="post" action="enterComment.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-6">
 		<p>Enter Work</p>
		<s:form name="addForm"  method="post" action="enterEffort.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:textfield name="effort" label="Effort" size="10"/>
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-7">
 		<p>Info-Needed</p>
		<s:form name="addForm"  method="post" action="infoNeeded.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-8">
 		<p> Resolve Issue</p>
		<s:form name="addForm"  method="post" action="resolveIssue.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:select label="Fix" headerKey="-1"
				headerValue="Select fix type" list="fixTypes" name="fixType" />
			<s:textfield name="effort" label="Effort (hours)" size="20"/>
			<s:textfield name="version" label="Version" size="20"/>
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-9">
 		<p>Verify</p>
		<s:form name="addForm"  method="post" action="verify.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:select label="Fix" headerKey="-1" 
				headerValue="Select fix type" list="verifyTypes" name="verified" />
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	<div id="tabs-10">
 		<p>Close</p>
		<s:form name="addForm"  method="post" action="close.action" theme="xhtml">
 			<s:textfield style="visibility:hidden" name="issueId" size="10"/>
			<s:textfield name="summary" label="Summary" size="60"/>
			<s:textarea  name="description" label="Comment" cols="60" rows="10"/>
			<s:submit type="button" name="Add" label="Save" />
		</s:form>
	</div>
	
	
</div>
</div>
</body>
</html>